** Do file to replicate Allard Duursma and Henning Tamm, "Crises and Negotiations in Mutual Interventions," Journal of Conflict Resolution. **

* This do file requires outreg2 and cem; remove the two asterisks below if you don't have these packages installed.
*ssc install outreg2
*ssc install cem

use "crises_negotiations_MIs.dta", clear

*Table 2 - Model 1* baseline
logit nego crisis external_any peacekeepers_dummy war leadership_time_min duration time_nego time_nego2 time_nego3, vce(cluster id) nolog
outreg2 using table2.doc, replace ctitle(Model 1) dec(3) adec(3) afmt(f) label addstat(Wald chi2, e(chi2), Prob > chi2, e(p)) title("Table 2. Main logit estimates on the likelihood of negotiations in mutual interventions in Africa.")
margins, at(crisis =(0(1)1))

*Table 2 - Model 2* war both
logit nego crisis external_any peacekeepers_dummy war_both leadership_time_min duration time_nego time_nego2 time_nego3, vce(cluster id) nolog
outreg2 using table2.doc, append ctitle(Model 2) dec(3) adec(3) afmt(f) label addstat(Wald chi2, e(chi2), Prob > chi2, e(p)) sortvar(crisis external_any peacekeepers_dummy war war_both leadership_time_min duration time_nego time_nego2 time_nego3)
margins, at(crisis =(0(1)1))

*Table 2 - Model 3* deaths
logit nego crisis external_any peacekeepers_dummy deaths_1ln leadership_time_min duration time_nego time_nego2 time_nego3 if year > 1988, vce(cluster id) nolog
outreg2 using table2.doc, append ctitle(Model 3) dec(3) adec(3) afmt(f) label addstat(Wald chi2, e(chi2), Prob > chi2, e(p)) sortvar(crisis external_any peacekeepers_dummy war war_both deaths_1ln leadership_time_min duration time_nego time_nego2 time_nego3)
margins, at(crisis =(0(1)1))

*Figure 1 ("Crises and negotiations in the mutual intervention between Angola and South Africa") *
graph bar (sum) crisis (sum) nego if id==4, over(duration, relabel(1 "Feb 1976" 2 " " 3 " " 4 " " 5 " " 6 "Jul 1976" 7 " " 8 " " 9 " " 10 " " 11 " " 12 "Jan 1977" 13 " " 14 " " 15 " " 16 " " 17 " " 18 "Jul 1977" 19 " " 20 " " 21 " " 22 " " 23 " " 24 "Jan 1978" 25 " " 26 " " 27 " " 28 " " 29 " " 30 "Jul 1978" 31 " " 32 " " 33 " " 34 " " 35 " " 36 "Jan 1979" 37 " " 38 " " 39 " " 40 " " 41 " " 42 "Jul 1979" 43 " " 44 " " 45 " " 46 " " 47 " " 48 "Jan 1980" 49 " " 50 " " 51 " " 52 " " 53 " " 54 "Jul 1980" 55 " " 56 " " 57 " " 58 " " 59 " " 60 "Jan 1981" 61 " " 62 " " 63 " " 64 " " 65 " " 66 "Jul 1981" 67 " " 68 " " 69 " " 70 " " 71 " " 72 "Jan 1982" 73 " " 74 " " 75 " " 76 " " 77 " " 78 "Jul 1982" 79 " " 80 " " 81 " " 82 " " 83 " " 84 "Jan 1983" 85 " " 86 " " 87 " " 88 " " 89 " " 90 "Jul 1983" 91 " " 92 " " 93 " " 94 " " 95 " " 96 "Jan 1984" 97 " " 98 " " 99 " " 100 " " 101 " " 102 "Jul 1984" 103 " " 104 " " 105 " " 106 " " 107 " " 108 "Jan 1985" 109 " " 110 " " 111 " " 112 " " 113 " " 114 "Jul 1985" 115 " " 116 " " 117 " " 118 " " 119 " " 120 "Jan 1986" 121 " " 122 " " 123 " " 124 " " 125 " " 126 "Jul 1986" 127 " " 128 " " 129 " " 130 " " 131 " " 132 "Jan 1987" 133 " " 134 " " 135 " " 136 " " 137 " " 138 "Jul 1987" 139 " " 140 " " 141 " " 142 " " 143 " " 144 "Jan 1988" 145 " " 146 " " 147 " " 148 " " 149 " " 150 "Jul 1988" 151 " " 152 " " 153 " " 154 " " 155 "Dec 1988") label(ticks angle(45) labsize(large))) ylabel(1 "Either" 2 "Both", nogrid labsize(large)) legend(label(1 "Crisis") label(2 "Negotiation") size(large)) bar(1, color(red)) bar(2, color(green)) ysize(2) graphregion (color(white) margin(large)) stack plotregion(margin(zero))

*Table A2 - Model A1* baseline lagged
logit nego crisis_lag external_any_lag peacekeepers_dummy_lag war_lag leadership_time_min duration time_nego time_nego2 time_nego3, vce(cluster id) nolog
outreg2 using tableA2.doc, replace ctitle(Model A1) dec(3) adec(3) afmt(f) label addstat(Wald chi2, e(chi2), Prob > chi2, e(p)) title("Table A2. Lagged logit estimates on the likelihood of negotiations in mutual interventions in Africa.")
margins, at(crisis =(0(1)1))

*Table A2 - Model A2* war both lagged
logit nego crisis_lag external_any_lag peacekeepers_dummy_lag war_both_lag leadership_time_min duration time_nego time_nego2 time_nego3, vce(cluster id) nolog
outreg2 using tableA2.doc, append ctitle(Model A2) dec(3) adec(3) afmt(f) label addstat(Wald chi2, e(chi2), Prob > chi2, e(p)) sortvar(crisis_lag external_any_lag peacekeepers_dummy_lag war_lag war_both_lag deaths_lag_1ln leadership_time_min duration time_nego time_nego2 time_nego3)
margins, at(crisis =(0(1)1))

*Table A2 - Model A3* deaths lagged
logit nego crisis_lag external_any_lag peacekeepers_dummy_lag deaths_lag_1ln leadership_time_min duration time_nego time_nego2 time_nego3 if year > 1988, vce(cluster id) nolog
outreg2 using tableA2.doc, append ctitle(Model A3) dec(3) adec(3) afmt(f) label addstat(Wald chi2, e(chi2), Prob > chi2, e(p)) sortvar(crisis_lag external_any_lag peacekeepers_dummy_lag war_lag war_both_lag deaths_lag_1ln leadership_time_min duration time_nego time_nego2 time_nego3)
margins, at(crisis =(0(1)1))

gen modate = ym(year, month) 
format %tm modate
xtset id modate
xtset id modate

*Table A3 - Model A4* baseline fixed effects
xtlogit nego crisis external_any peacekeepers_dummy war leadership_time_min duration time_nego time_nego2 time_nego3, fe nolog
outreg2 using tableA3.doc, replace ctitle(Model A4) dec(3) adec(3) afmt(f) label addstat(LR chi2, e(chi2), Prob > chi2, e(p)) title("Table A3. Fixed effects logit estimates on the likelihood of negotiations in mutual interventions in Africa.")

*Table A3 - Model A5* war both fixed effects
xtlogit nego crisis external_any peacekeepers_dummy war_both leadership_time_min duration time_nego time_nego2 time_nego3, fe nolog
outreg2 using tableA3.doc, append ctitle(Model A5) dec(3) adec(3) afmt(f) label addstat(LR chi2, e(chi2), Prob > chi2, e(p)) sortvar(crisis external_any peacekeepers_dummy war war_both leadership_time_min duration time_nego time_nego2 time_nego3)

*Table A3 - Model A6* deaths fixed effects
xtlogit nego crisis external_any peacekeepers_dummy deaths_1ln leadership_time_min duration time_nego time_nego2 time_nego3 if year > 1988, fe nolog
outreg2 using tableA3.doc, append ctitle(Model A6) dec(3) adec(3) afmt(f) label addstat(LR chi2, e(chi2), Prob > chi2, e(p)) sortvar(crisis external_any peacekeepers_dummy war war_both deaths_1ln leadership_time_min duration time_nego time_nego2 time_nego3)

*Table A4 - Model A7* baseline matched
imb external_any peacekeepers_dummy war leadership_time_min duration time_nego time_nego2 time_nego3, treatment(crisis)
cem external_any peacekeepers_dummy war leadership_time_min duration time_nego time_nego2 time_nego3, treatment(crisis)
logit nego crisis external_any peacekeepers_dummy war leadership_time_min duration time_nego time_nego2 time_nego3 [iweight=cem_weights], vce(cluster cem_strata) nolog
outreg2 using tableA4.doc, replace ctitle(Model A7) dec(3) adec(3) afmt(f) label addstat(Wald chi2, e(chi2), Prob > chi2, e(p)) title("Table A4. Matching logit estimates on the likelihood of negotiations in mutual interventions in Africa.")

*Table A4 - Model A8* war both matched
imb external_any peacekeepers_dummy war_both leadership_time_min duration time_nego time_nego2 time_nego3, treatment(crisis)
cem external_any peacekeepers_dummy war_both leadership_time_min duration time_nego time_nego2 time_nego3, treatment(crisis)
logit nego crisis external_any peacekeepers_dummy war_both leadership_time_min duration time_nego time_nego2 time_nego3 [iweight=cem_weights], vce(cluster cem_strata) nolog
outreg2 using tableA4.doc, append ctitle(Model A8) dec(3) adec(3) afmt(f) label addstat(Wald chi2, e(chi2), Prob > chi2, e(p)) sortvar(crisis external_any peacekeepers_dummy war war_both leadership_time_min duration time_nego time_nego2 time_nego3)

*Table A4 - Model A9* deaths matched
imb external_any peacekeepers_dummy deaths_1ln leadership_time_min duration time_nego time_nego2 time_nego3 if year > 1988, treatment(crisis)
cem external_any peacekeepers_dummy deaths_1ln leadership_time_min duration time_nego time_nego2 time_nego3 if year > 1988, treatment(crisis)
logit nego crisis external_any peacekeepers_dummy deaths_1ln leadership_time_min duration time_nego time_nego2 time_nego3 [iweight=cem_weights] if year > 1988, vce(cluster cem_strata) nolog
outreg2 using tableA4.doc, append ctitle(Model A9) dec(3) label sortvar(crisis external_any peacekeepers_dummy war war_both deaths_1ln leadership_time_min duration time_nego time_nego2 time_nego3)

*Table A5* Multinomial model
mlogit nego_type crisis external_any peacekeepers_dummy war leadership_time_min duration time_nego time_nego2 time_nego3, vce(cluster id) nolog
outreg2 using tableA5.doc, replace ctitle(Table A5) dec(3) label addstat(Wald chi2, e(chi2), Prob > chi2, e(p)) title("Table A5. Multinomial logit estimates on the likelihood of bilateral negotiations and mediated negotiations in mutual interventions in Africa, in comparison to no negotiations.")
margins, at(crisis =(0(1)1))
